package com.da.javatest.leetCode;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2018/12/14 14:50
 * @description
 */
public class Code832 {
    public static void main(String[] args) {
        int[][] A = {{1, 1, 0}, {1, 0, 1}, {0, 0, 0}};
        new Code832().flipAndInvertImage(A);
    }

    public int[][] flipAndInvertImage(int[][] A) {
        int[][] result = new int[A.length][];
        for (int i = 0; i < A.length; i++) {
            String str = new StringBuilder(Arrays.toString(A[i])).reverse().toString();
            str = str.replace("[", "");
            str = str.replace("]", "");
            str = str.replace("0", "2");
            str = str.replace("1", "0");
            str = str.replace("2", "1");
            str = str.replace(" ", "");
            String[] strs = str.split(",");
            result[i] = getNumbs(strs);
        }
        return result;
    }

    private int[] getNumbs(String[] strs) {
        int[] numbs = new int[strs.length];
        for (int i = 0; i < strs.length; i++) {
            numbs[i] = Integer.parseInt(strs[i]);
        }
        return numbs;
    }
}
